package cn.yoyo.service;

        import cn.yoyo.entity.SysUser;
        import cn.yoyo.mapper.UserMapper;
        import org.springframework.beans.factory.annotation.Autowired;
        import org.springframework.context.annotation.Primary;
        import org.springframework.security.core.userdetails.UserDetails;
        import org.springframework.security.core.userdetails.UserDetailsService;
        import org.springframework.security.core.userdetails.UsernameNotFoundException;
        import org.springframework.stereotype.Service;

@Primary
@Service
public class UserDetailsServiceImpl implements UserDetailsService {
    @Autowired(required = false)
    UserMapper userMapper;

    @Override
    public UserDetails loadUserByUsername(String account) throws UsernameNotFoundException {
        SysUser user = userMapper.findUserByAccount(account);
        return user;
    }
}
